local skel = fk.CreateSkill {
  name = "lb__zhisheng",
}

Fk:loadTranslationTable {
  ["lb__zhisheng"] = "制胜",
  [":lb__zhisheng"] = "出牌阶段限一次，你可以视为使用【决斗】。你可以移去2个“<b>斗志</b>”，视为打出一张【杀】并重置〖制胜〗。",

  ["#lb__zhisheng"] = "制胜：你可以视为使用【决斗】",
  ["#lb__zhisheng_slash"] = "制胜：你可以移去2个斗志，视为打出一张【杀】并重置〖制胜〗",

  ["$lb__zhisheng1"] = "对付你，一拳就够了！",
  ["$lb__zhisheng2"] = "怎么？要认输吗？！",
  ["$lb__zhisheng3"] = "值得我认真起来的对手！",
  ["$lb__zhisheng4"] = "欢呼声在哪？",
}


skel:addEffect("viewas", {
  anim_type = "defensive",
  audio_index = { 1, 2 },
  pattern = "slash,duel",
  prompt = "#lb__zhisheng",
  card_filter = Util.FalseFunc,
  view_as = function(self, player, cards)
    local card = Fk:cloneCard("duel")
    card.skillName = skel.name
    return card
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) < 1 and player.phase == Player.Play
  end,
  enabled_at_response = function(test, player, response)
    return not response and player:usedSkillTimes(skel.name, Player.HistoryPhase) < 1 and player.phase == Player.Play
  end,
})

skel:addEffect(fk.AskForCardResponse, {
  audio_index = { 3, 4 },
  is_delay_effect = true,
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player:getMark('@lb__douzhi') > 1 and
        not player:prohibitResponse(Fk:cloneCard("slash")) and
        not data.result and Exppattern:Parse(data.pattern):matchExp("slash")
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = skel.name,
      prompt = "#lb__zhisheng_slash",
    })
  end,
  on_use = function(self, event, target, player, data)
    player.room:removePlayerMark(player, "@lb__douzhi", 2)
    local card = Fk:cloneCard("slash")
    card.skillName = skel.name
    data.result = {
      card = card,
      from = player,
    }
    player:setSkillUseHistory(skel.name)
  end,
})

return skel
